from django.db import models

from users.models import User


<<<<<<< .merge_file_45VGMc
class LanguageCategory(models.Model):
    language = models.CharField(max_length=10,verbose_name='语言类')

=======
class Lable(models.Model):
    name = models.CharField(max_length=10,verbose_name='标签')
    class Meta:
        db_table = 'tb_lables'
        verbose_name = '标签表'
        verbose_name_plural = verbose_name

class LanguageCategory(models.Model):
    language = models.CharField(max_length=10,verbose_name='语言类')
>>>>>>> .merge_file_mvUpzc
    class Meta:
        db_table = 'tb_language'
        verbose_name = '语言表'
        verbose_name_plural = verbose_name




class Questions(models.Model):
    view_counts  = models.IntegerField(default=0,verbose_name='浏览量')
    pub_time = models.DateTimeField(verbose_name='提问时间',auto_now=True)
    pub_user_id = models.ForeignKey(User,related_name='questions_user',verbose_name='发布者id')
    useful_counts = models.IntegerField(default=0,verbose_name='有用量')
    update_time = models.DateTimeField(verbose_name='问题更新时间',auto_now=True)
<<<<<<< .merge_file_45VGMc
    language_id = models.ForeignKey(LanguageCategory,verbose_name='所属语言')
    title = models.CharField(max_length=32,verbose_name='标题')
    lable = models.ManyToManyField(to='Lable')
=======
    title = models.CharField(max_length=32,verbose_name='标题')
    lable = models.ManyToManyField(to='Lable')
    content = models.TextField(default='wu',verbose_name='内容')
>>>>>>> .merge_file_mvUpzc


    class Meta:
        db_table = 'tb_questions'
        verbose_name = '问题表'
        verbose_name_plural = verbose_name

<<<<<<< .merge_file_45VGMc
    def __str__(self):
        return  self.title


class Answer(models.Model):
    comments = models.TextField(verbose_name='内容')
    parent_id = models.IntegerField(default=None,verbose_name='父评论id')
    questions_id = models.ForeignKey(Questions,verbose_name='问题id')
    answer_time = models.DateTimeField(verbose_name='回答时间',auto_now=True)
    answer_user_id = models.ForeignKey(User,verbose_name='回答作者id')
=======



class Answer(models.Model):
    comments = models.TextField(default='',verbose_name='内容')
    parent_id = models.IntegerField(default=None,verbose_name='父评论id')
    questions_id = models.ForeignKey(Questions,verbose_name='问题id',default=1)
    answer_time = models.DateTimeField(verbose_name='回答时间',auto_now=True)
    answer_user_id = models.ForeignKey(User,verbose_name='回答作者id',default=1)
>>>>>>> .merge_file_mvUpzc
    answer_counts = models.IntegerField(default=0)

    class Meta:
        db_table = 'tb_answers'
        verbose_name = '回答表'
        verbose_name_plural = verbose_name


<<<<<<< .merge_file_45VGMc
class Lable(models.Model):
    name = models.CharField(max_length=10,verbose_name='标签')
    class Meta:
        db_table = 'tb_lables'
        verbose_name = '标签表'
        verbose_name_plural = verbose_name

=======
>>>>>>> .merge_file_mvUpzc




